package p500.srm513;

import utils.ExampleRunner;

/**
 * Created by IntelliJ IDEA.
 * User: smalex
 * Date: 7/26/11
 * Time: 3:03 PM
 */
public class TrainingCamp {
  public String[] determineSolvers(String[] attendances, String[] problemTopics) {
    final String[] result = new String[attendances.length];
    for (int i = 0; i < attendances.length; i++) {
      String attendance = attendances[i];
      String res = "";
      for (int j = 0; j < problemTopics.length; j++) {
        String problemTopic = problemTopics[j];
        boolean ok = true;
        for (int k = 0; k < problemTopic.length(); k++) {
          boolean need = problemTopic.charAt(k) == 'X';
          if (need) {
            if (attendance.charAt(k) != 'X') {
              ok = false;
              break;
            }
          }
        }
        res += ok ? "X" : "-";
      }
      result[i] = res;
    }
    return result;
  }

  public static void main(String[] args) {
    ExampleRunner.eq(1,
        new String[]{"XXXX", "XXXX", "X--X"},
        new TrainingCamp().determineSolvers(
            new String[]{"XXX", "XXX", "XX-"},
            new String[]{"---", "XXX", "-XX", "XX-"}));
  }
}
